var App = angular.module('App', ['ui.bootstrap']);
App.controller('FetchCtrl', function($scope) {
    $scope.test = "AAVVBB";
})
    .controller('AccordionDemoCtrl', function($scope) {
        $scope.oneAtATime = true;

        $scope.groups = [
            {
                title: 'Dynamic Group Header - 1',
                content: 'Dynamic Group Body - 1'
            },
            {
                title: 'Dynamic Group Header - 2',
                content: 'Dynamic Group Body - 2'
            }
        ];

        $scope.items = ['Item 1', 'Item 2', 'Item 3'];

        $scope.addItem = function() {
            var newItemNo = $scope.items.length + 1;
            $scope.items.push('Item ' + newItemNo);
        };

        $scope.status = {
            isFirstOpen: true,
            isFirstDisabled: false
        };
    })

    .controller('WizardCtrl', function($scope, $http) {

        $scope.test = "AADDD";
        var URL = "mydata.json",
            URL2 = "getvarf4.xml",
            URL3 = "getdata.json",
            METHOD = "GET";


        $scope.loadData2 = function() {
            $http({method: METHOD, url: URL2})
                .success(function (data) {
                    $scope.data = data;

                })
                .error(function (error) {
                    $scope.status = 'Unable to load query data: ' + error.message;
                    $scope.data = data;
                });
        }

        $scope.loadData3 = function() {
            $http({method: METHOD, url: URL3})
                .success(function (data) {
                    $scope.engineTree = data;
                })
                .error(function (error) {
                    $scope.status = 'Unable to load query data: ' + error.message;
                    $scope.data = data;
                });
        }

        $scope.loadData = function() {
            $http({method: METHOD, url: URL})
                .success(function (data) {
                    $scope.engineTree = data.root;
                })
                .error(function (error) {
                    $scope.status = 'Unable to load query data: ' + error.message;
                    $scope.data = data;
                });
        };

        $scope.engineTree = [];


        /* init function */
        $scope.loadData();

    })

    .directive('helloWorld', function() {
        return {

            template: '<p> eetet{{name}} : {{id}} : {{value}} : {{selector}}</p>',
            replace: true,
            scope: {
                name: '=',
                id: '=',
                value: '=',
                selector: '='
            }
        }
})
    .directive('themeEngineTextbox', function() {
        return {
            restrict: 'E',
            template: "<p>{{label}} : {{css}} : {{value}} : {{selectors}} : {{ component }}</p>",
            replace: true,
            scope: {
                label: '@',
                css: '@',
                value: '@',
                selectors: '@',
                component: '@'
            },
            link: function(scope, elem, attrs) {

            }
        };
    });




;